Repository navigation
Conversation
…r opt-in (#787) Slice E: on an opted-in server (SshServeOptions::kitty_keyboard; serve command env ID_WORLD_SSH_KITTY_KEYBOARD), a raw SSH session whose F13.4 probe reported kitty keyboard support pushes kitty-disambiguate-v1, verifies the flags report before admitting keys, frames input with the Slice B assembler (one complete key token per durable Input event), and pops exactly its own push on fallback and on every teardown path. Verification failure or timeout pops and falls back to legacy chunk input with held bytes untouched. Command, explorer and exec sessions never negotiate; defaults are legacy everywhere. The assembler moves from the id facade into id-worlds (the SSH adapter's crate); the facade re-exports it, so id::input_framing is unchanged. Slice F: the web world page selects the Slice C rich encoder per connection via ?keyboard=kitty; legacy remains the default, paste and the manual input form keep their existing paths. Tests: kitty.rs unit tests (filter, verification, fallback byte fidelity, split tokens); world_ssh integration tests (negotiate + split-input framing + Escape/Alt distinction + teardown pop, verify fallback, no-opt-in, unsupported terminal); web opt-in contract tests (DOM to WebSocket, both modes, paste/shortcut exclusions).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00520a8a3e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| None => { | ||
| let held = self.close_terminal_probe(); | ||
| if !held.is_empty() { | ||
| return Inbound::Text(raw_frame(&SshInputFrame::Bytes(held))); | ||
| } |
There was a problem hiding this comment.
Start negotiation when the probe closes without held input
On an opted-in connection whose terminal answers the startup probe without any accompanying keystrokes, closing the probe normally returns no held bytes. This branch then continues the inner legacy receive loop without revisiting maybe_begin_kitty(), which is called only before that loop. In a quiet world, negotiation therefore stalls until another keystroke or unrelated world event arrives, and that first keystroke is forwarded with legacy chunk semantics. Recheck activation immediately after closing the probe and draining any held input.
Useful? React with 👍 / 👎.
| if let Some(token) = self.kitty.take_token() { | ||
| return KittyRead::Token(token); |
There was a problem hiding this comment.
Hold queued keys until verification completes
If a key arrives before the post-push flags reply, feed() queues its token while the keyboard remains in Verifying, but this unconditional dequeue immediately returns it as application input. Consequently, keys can affect the world and enter its journal before the push has been verified, including when verification subsequently fails. Only release queued tokens after entering Active or completing the fallback to legacy input.
Useful? React with 👍 / 👎.
| /// the caller writes the pop. Returns whether a pop is owed. | ||
| pub fn fallback(&mut self) -> bool { | ||
| self.phase = KittyPhase::Inactive; | ||
| self.assembler = InputAssembler::new(Limits::default()); |
There was a problem hiding this comment.
Preserve pending token bytes when falling back
If verification times out while a transport-split key is incomplete, replacing the assembler silently discards the received prefix. For example, receiving ESC [ 97 ; before the timeout and 5u afterward causes only 5u to reach the legacy path, turning part of a control-key sequence into ordinary application text. Preserve pending bytes in arrival order during fallback, or close the session if they cannot be safely forwarded, rather than continuing with a truncated stream.
Useful? React with 👍 / 👎.
| // saw leave a gap no resynchronisation can repair (design | ||
| // §4.2). The counter is shared with the russh handler, so only | ||
| // growth past the activation baseline is this stream's loss. | ||
| if self.dropped_input.load(Ordering::Relaxed) > self.kitty_drop_baseline { |
There was a problem hiding this comment.
Track fatal queue loss independently of the notice counter
When the active SSH input queue overflows by at least 1,024 bytes, an outbound world event can erase the loss evidence before this check runs: SshIo::send() calls claim_dropped_input_notice(), which subtracts the observed count from dropped_input. The session loop selects outbound events against io.recv(), so this ordering is possible during normal operation. This counter is therefore not monotonic, and comparing it with the activation baseline can miss a fatal gap and continue journaling a truncated key stream. Use a monotonic loss counter or sticky failure flag that displaying the notice cannot clear.
Useful? React with 👍 / 👎.
Implements the two remaining slices of #787 per
doc/2026-11-01_design_id787.md§6. Slices A–D were already on main (Roc decoder #4438, assembler, browser encoder #7734, parity oracle #12926), and the F13.4 startup probe already recordskitty_keyboardsupport in the SSH adapter — this PR wires activation to that evidence. This PR does not close #787: the issue's final acceptance also wants one supported-terminal smoke session (and the unsupported fallback) recorded against a real terminal, which a remote test run cannot supply.Slice E — opt-in SSH lifecycle integration (
world_ssh)SshServeOptions { kitty_keyboard }(default off);serve()delegates toserve_with_options(). The serve command maps envID_WORLD_SSH_KITTY_KEYBOARD=1to it, following the existingID_WORLD_*env pattern, with a status line when enabled.CSI > 1 u+ flags queryCSI ? uand verifies before admitting any key: tokens assembled during verification are held; a flags report carrying the disambiguation bit activates framing, one without it — or a 500 ms timeout — pops the owned push and falls back to legacy chunk input with held bytes untouched. One attempt per connection (no renegotiation loop).Inputevent, exact bytes preserved, split/CSI/UTF-8 safe. Verification replies are consumed by an outstanding-query-only filter — never journaled. Framing errors, incomplete token at EOF/deadline, and input-queue loss past the activation baseline are fatal to the session (no unsafe resync).idfacade intoid-worlds(the adapter's crate); the facade re-exports it, soid::input_framingis unchanged.Slice F — browser opt-in (
web)world.tsselectsrichTerminalBytesForKeyper connection when the page is opened with?keyboard=kitty; legacy stays the default. Paste, the manual input form, and Meta/Dead/Process exclusions are unchanged in both modes.Tests
world_ssh::kittyunit tests: flags-report grammar, outstanding-only consumption, verify flip/refusal, coalesced key order, fallback byte fidelity, split tokens.world_sshintegration tests (real russh client + world event subscription): negotiate → verify → split CSI-u framed as one event, Escape vs Alt+x as distinct events, no reply bytes journaled, exactly one pop at teardown; verification-refused fallback (held key delivered, legacy resumes, no second push); no negotiation without the opt-in; no push when the terminal reports no support.world-keyboard-optin.test.ts— DOM → WebSocket in both modes (legacy bare Escape1bvs kittyCSI 27 u, Ctrl+i vs Tab, Alt+x), paste + shortcut exclusions under the opt-in.Verification state (read this before merging)
Remote dispatches were queued while runner surfaces were exhausted; all three were still
queued(no surface) when this PR was opened. Handles (branch head00520a8a3):cargo test -p id-worlds --features ssh world_ssh+input_framing):fp_250be4a8258466cd46be42840fee197bfp_b7b9a7f0f820ca7eb716a93e47b95c1aid-worlds,id-cli,id, all targets/features):fp_ac36488f6ba6798b5a8af6a3cba2b93eThe jobs are recorded in the fleet queue and run when a surface frees; results land under
fleet queue session result <handle>. Local verification was rustfmt only (remote-builds-only rule). No new dependencies.Residuals named in the design
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.